﻿<controlli:BaseCusControl x:Class="DocManagerControls.Controls.CreaWFControl"
             xmlns:controlli="clr-namespace:DocManagerControls.Controls"
             xmlns:convert="clr-namespace:DocManagerControls.Converters"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"              
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" Background="GreenYellow"
             JournalEntry.Name="Crea Iter" mc:Ignorable="d" MinHeight="300" MinWidth="300">
    <Grid>

        <TabControl MinHeight="300" HorizontalAlignment="Left" Margin="1" 
                    Name="tabControl1" VerticalAlignment="Top" MinWidth="200">

            <TabItem Header="Workflow esistenti" Name="tabItem3">
                <StackPanel Orientation="Horizontal">
                    <ListView MinHeight="100" MinWidth="300" Name="listWorkfEsistenti" Width="Auto" Background="Bisque"
                          ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" >
                        <ListView.Resources>
                            <convert:ConverterExtToImage x:Key="converterExtToImage" />
                        </ListView.Resources>
                        <ListView.ContextMenu>
                            <ContextMenu Name="contMenulstWorkflows" StaysOpen="true" Background="Cornsilk" MenuItem.Click="contMenulstWorkflows_Click"  >
                                <ContextMenu.BitmapEffect>
                                    <OuterGlowBitmapEffect />
                                </ContextMenu.BitmapEffect>
                                <MenuItem Header="Modifica" Margin="2" >
                                    <MenuItem.Icon>
                                        <Image Source="..\IMG\modMedia.gif"/>
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </ListView.ContextMenu>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Border BorderBrush="Blue" BorderThickness="2" CornerRadius="3" Margin="2">
                                    <StackPanel  Tag="{Binding}" >
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Fk_IDDoc}" Width="Auto"  Margin="2" />
                                            <TextBlock Text="{Binding UserName}" Width="Auto" Margin="2" />
                                            <TextBlock Text="{Binding Mittente}" Width="Auto" Margin="2" />
                                            <TextBlock Text="{Binding Titolo}" Margin="2" />
                                            <TextBlock Text="{Binding DataScadenza}" Margin="2"  />
                                            <TextBlock Text="{Binding Completato}" Margin="2"  />
                                            <TextBlock Text="{Binding Passaggio}" Margin="2"  />
                                        </StackPanel>

                                        <TextBlock Text="{Binding Messaggio}" Width="150" />

                                    </StackPanel>
                                </Border>
                            </DataTemplate>
                        </ListView.ItemTemplate>

                    </ListView>
                    
                </StackPanel>
            </TabItem>

            <TabItem Header="Workflow Generale" Name="tabItem1">
                <StackPanel Orientation="Horizontal">

                    <StackPanel Margin="2">
                        
                        <StackPanel Orientation="Horizontal" Margin="3" Background="Gold">
                            <Label Content="Mittente" Width="70" Opacity="100"/>
                            <TextBox Name="txtMittente" Width="100"  Opacity="10"></TextBox>
                            <TextBlock Name="txtGuidMittente" Width="300" Margin="10,0,0,0" Opacity="80"></TextBlock>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="3" Background="Gold">
                            <Label Content="Id Doc." Width="70" Opacity="100"/>
                            <TextBox Name="txtIDdoc" Width="100" PreviewTextInput="txtIDdoc_PreviewTextInput" Opacity="10"></TextBox>
                            <TextBlock Name="txtFileName" Width="300" Margin="10,0,0,0" Opacity="80"></TextBlock>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="3" Background="Gold">
                            <Label Content="Data scad." Width="70" Opacity="100"/>
                            <DatePicker Height="25" Name="datePicker1" Width="150" />
                            <Label Content="Data creaz." Width="70" Opacity="100"/>
                            <Label x:Name="txtDataCreazione"  Content="" Width="70" Opacity="100"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="3" Background="Gold">
                            <Label Content="Stato" Width="70" Opacity="100"/>
                            <TextBlock Name="txtStato" Width="100" Margin="10,0,0,0" Opacity="80"></TextBlock>
                            <Label Content="Passaggio" Width="70" Opacity="100"/>
                            <TextBlock Name="txtPassaggio" Width="100" Margin="10,0,0,0" Opacity="80"></TextBlock>
                        </StackPanel>
                        
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10">
                            <Button Content="Crea Iter" Height="23" Name="btnCreaIter" Width="75" Margin="5"/>
                            <Button Content="Cancella Iter" Height="23" Name="btnCancellaIter" Width="75" Margin="5" />
                        </StackPanel>

                    </StackPanel>
                </StackPanel>
                
            </TabItem>
            
            <TabItem Header="Gestione Iters Workflow" Name="tabItem2">
                <StackPanel Orientation="Horizontal">
            
            <StackPanel Margin="2">
                            
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Content="Aggiungi passaggio" Margin="3" Height="23" Name="btnAddPassaggio" Width="150" Click="btnAddPassaggio_Click" />
                <Button Content="Salva Iter" Margin="3" Height="23" Name="btnSalvaIter" Width="150" Click="btnSalvaIter_Click" />
                </StackPanel>
                
                <ListView MaxHeight="300" Name="lstIters" Width="Auto" Margin="3" ScrollViewer.CanContentScroll="True"
                          ScrollViewer.VerticalScrollBarVisibility="Auto">
                    <ListView.Resources>
                        <convert:ConverterExtToImage x:Key="converterExtToImage" />
                    </ListView.Resources>
                    <ListView.ContextMenu>
                        <ContextMenu Name="contMenu" StaysOpen="true" Background="Cornsilk" MenuItem.Click="contMenu_Click"  >
                            <ContextMenu.BitmapEffect>
                                <OuterGlowBitmapEffect />
                            </ContextMenu.BitmapEffect>
                            <MenuItem Header="Modifica" Margin="2" >
                                <MenuItem.Icon>
                                    <Image Source="..\IMG\modMedia.gif"/>
                                </MenuItem.Icon>
                            </MenuItem>
                        </ContextMenu>
                        </ListView.ContextMenu>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                            <Border BorderBrush="Blue" BorderThickness="2" CornerRadius="3" Margin="2">
                                <StackPanel  Tag="{Binding}" >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding Fk_IDDoc}" Width="Auto"  Margin="2" />
                                        <TextBlock Text="{Binding Destinatario}" Width="Auto" Margin="2" />
                                        <TextBlock Text="{Binding Titolo}" Margin="2" />
                                        <TextBlock Text="{Binding AttivitaIter.Attività}" Margin="2"  />                                      
                                    </StackPanel>
                                    
                                    <TextBox Text="{Binding Messaggio}" MaxWidth="450" AcceptsReturn="True" MaxHeight="120" />
                                    
                            </StackPanel>
                            </Border>
                        </DataTemplate>
                        </ListView.ItemTemplate>
                    
                </ListView>
                
            </StackPanel>
            
        </StackPanel>      
            </TabItem>
            
        </TabControl>
    </Grid>
</controlli:BaseCusControl>
